luci-proto-3g/ppp/pppossh: fix being unable to set keepalive to 0
authorPreport <[email protected]>
Thu, 14 Nov 2024 20:07:05 +0000 (23:07 +0300)
committerPaul Donald <[email protected]>
Sat, 30 Nov 2024 04:16:59 +0000 (05:16 +0100)
Since on openwrt keepalive option defaults to "5 1" when it's not
defined:
https://github.com/openwrt/openwrt/blob/6720c4ccba256186bf2f1b1edadb851c447e62a5/package/network/services/ppp/files/ppp.sh#L128

Users must be able to set it to 0 to ignore connection failures.

Signed-off-by: Erdem Gez <[email protected]>
Signed-off-by: Paul Donald <[email protected]>
protocols/luci-proto-3g/htdocs/luci-static/resources/protocol/3g.js
protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/ppp.js
protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/pppoa.js
protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/pppoe.js
protocols/luci-proto-ppp/htdocs/luci-static/resources/protocol/pptp.js
protocols/luci-proto-pppossh/htdocs/luci-static/resources/protocol/pppossh.js

index 1d599dc822b6daf3dd0dfa0f7e0aa8826e94d969..1e0cb6ba33d8fb2ab8a1721e0c526532ac7a2d51 100644 (file)
@@ -26,13 +26,13 @@ function write_keepalive(section_id, value) {
            f = (f_opt != null) ? +f_opt[0].formvalue(section_id) : null,
            i = (i_opt != null) ? +i_opt[0].formvalue(section_id) : null;
 
-       if (f == null || f == '' || isNaN(f))
-               f = 0;
+       if (f === '' || isNaN(f))
+               f = null;
 
        if (i == null || i == '' || isNaN(i) || i < 1)
                i = 1;
 
-       if (f > 0)
+       if (f !== null)
                uci.set('network', section_id, 'keepalive', '%d %d'.format(f, i));
        else
                uci.unset('network', section_id, 'keepalive');
index 4bd88be5bb271172ddfa0405df51e40529aa2ffe..c7f7103125d5ee431252dfe5fa89918a777fb3c8 100644 (file)
@@ -26,13 +26,13 @@ function write_keepalive(section_id, value) {
            f = (f_opt != null) ? +f_opt[0].formvalue(section_id) : null,
            i = (i_opt != null) ? +i_opt[0].formvalue(section_id) : null;
 
-       if (f == null || f == '' || isNaN(f))
-               f = 0;
+       if (f === '' || isNaN(f))
+               f = null;
 
        if (i == null || i == '' || isNaN(i) || i < 1)
                i = 1;
 
-       if (f > 0)
+       if (f !== null)
                uci.set('network', section_id, 'keepalive', '%d %d'.format(f, i));
        else
                uci.unset('network', section_id, 'keepalive');
index 0a5dc957882a3ce6fabc9f94cda46c2bdd12af6c..b1f945caf99e45e4515dd5a9cba442b3964053a6 100644 (file)
@@ -11,13 +11,13 @@ function write_keepalive(section_id, value) {
            f = (f_opt != null) ? +f_opt[0].formvalue(section_id) : null,
            i = (i_opt != null) ? +i_opt[0].formvalue(section_id) : null;
 
-       if (f == null || f == '' || isNaN(f))
-               f = 0;
+       if (f === '' || isNaN(f))
+               f = null;
 
        if (i == null || i == '' || isNaN(i) || i < 1)
                i = 1;
 
-       if (f > 0)
+       if (f !== null)
                uci.set('network', section_id, 'keepalive', '%d %d'.format(f, i));
        else
                uci.unset('network', section_id, 'keepalive');
index 0a891eb32ecb1a694a9d6c7c3340c3616e52616b..d028a18a87fef39cf927cd668bf8d216825c18e5 100644 (file)
@@ -11,13 +11,13 @@ function write_keepalive(section_id, value) {
            f = (f_opt != null) ? +f_opt[0].formvalue(section_id) : null,
            i = (i_opt != null) ? +i_opt[0].formvalue(section_id) : null;
 
-       if (f == null || f == '' || isNaN(f))
-               f = 0;
+       if (f === '' || isNaN(f))
+               f = null;
 
        if (i == null || i == '' || isNaN(i) || i < 1)
                i = 1;
 
-       if (f > 0)
+       if (f !== null)
                uci.set('network', section_id, 'keepalive', '%d %d'.format(f, i));
        else
                uci.unset('network', section_id, 'keepalive');
index d8fd67166a829ab5abf48f582659583482d4b8f3..3ee6e69cb12cee1b9ba0090792d3d252e60a800e 100644 (file)
@@ -11,13 +11,13 @@ function write_keepalive(section_id, value) {
            f = (f_opt != null) ? +f_opt[0].formvalue(section_id) : null,
            i = (i_opt != null) ? +i_opt[0].formvalue(section_id) : null;
 
-       if (f == null || f == '' || isNaN(f))
-               f = 0;
+       if (f === '' || isNaN(f))
+               f = null;
 
        if (i == null || i == '' || isNaN(i) || i < 1)
                i = 1;
 
-       if (f > 0)
+       if (f !== null)
                uci.set('network', section_id, 'keepalive', '%d %d'.format(f, i));
        else
                uci.unset('network', section_id, 'keepalive');
index 343a56b3ecc2b26a2b39ceee9645ada5f13af931..bc1345ee3e7866cc3cc83dcfcaeda6b4e92ff121 100644 (file)
@@ -11,13 +11,13 @@ function write_keepalive(section_id, value) {
            f = (f_opt != null) ? +f_opt[0].formvalue(section_id) : null,
            i = (i_opt != null) ? +i_opt[0].formvalue(section_id) : null;
 
-       if (f == null || f == '' || isNaN(f))
-               f = 0;
+       if (f === '' || isNaN(f))
+               f = null;
 
        if (i == null || i == '' || isNaN(i) || i < 1)
                i = 1;
 
-       if (f > 0)
+       if (f !== null)
                uci.set('network', section_id, 'keepalive', '%d %d'.format(f, i));
        else
                uci.unset('network', section_id, 'keepalive');